﻿using Microsoft.Owin.Cors;
using Owin;
using System.Web.Http;

namespace WebApiSelfByWinform
{
    public class Startup
    {
        public void Configuration(IAppBuilder app)
        {
            app.UseCors(CorsOptions.AllowAll);//设置允许跨域
            var config = new HttpConfiguration();
            config.MapHttpAttributeRoutes();//允许特性路由
            config.Routes.MapHttpRoute("DefaultApi", "api/{controller}/{id}",
                new {id = RouteParameter.Optional});
            app.UseWebApi(config);//webApi托管
            app.MapSignalR();
        }
    }
}
